package other;

/**
 * @description: 使用enum关键字定义枚举。5.0新增的
 * @author: apple
 * @date:  2021/12/11 11:10 下午
 * @version 1.0
 **/
public class EnumTest {

    public static void main(String[] args) {
        Season spring = Season.SPRING;
        System.out.println(spring.toString());
        System.out.println(spring.getName());
        System.out.println(spring.getDes());

        System.out.println(Season.class.getSuperclass());

        Season summary = Season.valueOf("SUMMARY");
        System.out.println(summary);
        System.out.println(summary.name());

    }
}


enum Season {

    SPRING("春天","春暖花开"),
    SUMMARY("夏天","烈日炎炎");

    private final String name;
    private final String des;

    Season(String name, String des) {
        this.name = name;
        this.des = des;
    }

    public String getName() {
        return name;
    }

    public String getDes() {
        return des;
    }
}